package game.components;

import com.uqbar.vainilla.DeltaState;

public class WorkingTimer extends TimerState {
	
	private static final int REFRESH_UNITS = 100;

	public WorkingTimer(TimerLabel timer) {
		super(timer);
	}

	@Override
	public void update(DeltaState deltaState) {
		if (this.getTimer().getRefreshTime() <= 0) {
			this.getTimer().setSeconds(this.getTimer().getSeconds() + 15);
			if (this.getTimer().getSeconds() == 60) {
				this.getTimer().setMinutes(this.getTimer().getMinutes() + 1);
				this.getTimer().setSeconds(0);
			}
			this.getTimer().showInformation(this.getTimer().getMinutes() + " : " + this.getTimer().getSeconds());
			this.getTimer().setRefreshTime(REFRESH_UNITS);
		}
		this.getTimer().setRefreshTime(this.getTimer().getRefreshTime() - 1);
	}

}
